var username="CEAIRSHA003";
var password="SHA003";
var localLoginInfor = localStorage.getItem("MU30-USERINFO");
//var calluser=localLoginInfor.username;
 var calluser="CEAIRSHA003";
/**
 * 字符转ASCII码
 */
function native2ascii(character){
	var ascii="";
	for(var i=0;i<character.length;i++){
		var code=Number(character[i].charCodeAt(0));
			var charAscii=code.toString(16);
			charAscii=new String("0000").substring(charAscii.length,4)+charAscii;
			ascii+="\\u"+charAscii;
	}
	return ascii;
}
/**
 * 获取设备信息
 */
function getDevice()
{
	var imei="";
	var device = appcan.require('device');
	device.getDeviceInfo(function(deviceInfo,singleInfo,i,len,completeCount){
		imei=i;
		return imei;
	});
	return imei;
}
/**
 * 证件号码显示处理：>5字符：前3后2，其余隐藏，<5全部隐藏
 * @param {Object} idnum
 */
function IdShowHandler(idnum)
{
	var str;
	var len=idnum.length;
	if(len>5)
	{
		var paw='';
		for(var i=0;i<len-5;i++)
		{
			paw+='*';
		}
		str=idnum.substr(0,3)+paw+idnum.substr(len-2);
	}else
	{
		str='*****'; 
	}
	return str;
}
function timeRormate(timeslot)
{
	var arr=timeslot.split("-");
		var y=arr[0];
		var m=arr[1];
		m=m.length>2?m.substr(1,2):m;
		var d=arr[2];
		d=d.length>2?d.substr(1,2):d;
		timeslot=y+"-"+m+"-"+d;
		return timeslot;
}

/***
 * 舱位字符串提交
 * @param {Object} arr
 */
function judgeChecked(arr)
{
	var str='';
	
	var len=arr.length;
	for(var i=0;i<len;i++)
	{
		if($$(arr[i]).checked)
		{
			str+=arr[i].split('_')[1]+",";
		}
	}
	var ind=str.lastIndexOf(",")
	return str.substr(0,ind);
}

//本地存储
var lcstor = window.localStorage;
function setStorage(key, value) {
    if (lcstor)
        lcstor[key] = value;
    //else 
    //alert('localStorage error');
}
function getStorage(key) {
    if (lcstor) {
        for (i in lcstor) {
            if (i == key)
                return lcstor[i];
        }
    }
    //else 
    //alert('localStorage error');
}
/**
 * android 返回按钮退出应用
 */
function exitKeyPressedListener()
{
	  uexWindow.onKeyPressed = function(keyCode){
                    if (keyCode == 0){
                      uexWidget.finishWidget('');
                    }
               }
}
